﻿/**********************************************************************************
 * Project Name :   
 * Remarks      :  
 * Class Name   :  ProcessModel 
 * Version      :  v1.0.0.0 
 * Author       :  Joey Liang 
 * Description  : 
 * Created Time :  2013/8/14 22:38:59
 * Update Man   :  Joey Liang
 * Update Time  :  2013/8/14 22:38:59
************************************************************************/

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace JoeyLibs.IdleStartMenu.Model
{
    /// <summary>
    /// 进程模型
    /// </summary>
    public class ProcessModel : BaseModel
    {
        private string name;
        /// <summary>
        /// 进程名
        /// </summary>
        public virtual string Name
        { 
            get { return this.name; }
            set{ this.name = value; } 
        }

        private string processPath;
        /// <summary>
        /// 进程目录
        /// </summary>
        public virtual string ProcessPath
        {
            get { return this.processPath; }
            set { this.processPath = value; }
        }

        private string filePath;
        /// <summary>
        /// 进程默认打开的文件
        /// </summary>
        public virtual string FilePath
        {
            get { return this.filePath; }
            set { this.filePath = value; }
        }

        private string arguments;
        /// <summary>
        /// 启动进程的命令参数
        /// </summary>
        public virtual string Arguments
        {
            get { return this.arguments; }
            set { this.arguments = value; }
        }

        private int orderNum;
        /// <summary>
        /// 排序字段（升序）
        /// </summary>
        public virtual int OrderNum
        {
            get { return this.orderNum; }
            set { this.orderNum = value; }
        }

        private MenuProcessType processType;
        /// <summary>
        /// 进程类型
        /// </summary>
        public virtual MenuProcessType ProcessType
        {
            get { return this.processType; }
            set { this.processType = value; }
        }

        public override bool Equals(object obj)
        {
            if (obj is ProcessModel)
            {
                ProcessModel model = obj as ProcessModel;
                return  (model.ProcessPath == this.ProcessPath && model.Arguments == this.Arguments)
                    || base.Equals(obj);
            }

            return false;
        }

        /// <summary>
        /// 便于调试时显示使用
        /// </summary>
        /// <returns></returns>
        public override string ToString()
        {
            return this.name + "  " + this.orderNum;
        }
    }
}
